home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / windows / wdj1096.zip / ZOLMAN.ZIP / ZVBDLG.ZIP / GENERIC.CPP < prev    next >
C/C++ Source or Header  |  1996-01-16  |  4KB  |  150 lines

  1. // generic.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "generic.h"
  6.  
  7. #include "mainfrm.h"
  8. #include "generdoc.h"
  9. #include "genervw.h"
  10.  
  11. #include "zvbdlg.h"
  12. #include "zspin.h"
  13.  
  14. #ifdef _DEBUG
  15. #undef THIS_FILE
  16. static char BASED_CODE THIS_FILE[] = __FILE__;
  17. #endif
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CGenericApp
  21.  
  22. BEGIN_MESSAGE_MAP(CGenericApp, CWinApp)
  23.     //{{AFX_MSG_MAP(CGenericApp)
  24.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  25.         // NOTE - the ClassWizard will add and remove mapping macros here.
  26.         //    DO NOT EDIT what you see in these blocks of generated code!
  27.     //}}AFX_MSG_MAP
  28.     // Standard file based document commands
  29.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  30.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  31. END_MESSAGE_MAP()
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CGenericApp construction
  35.  
  36. CGenericApp::CGenericApp()
  37. {
  38.     // TODO: add construction code here,
  39.     // Place all significant initialization in InitInstance
  40. }
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // The one and only CGenericApp object
  44.  
  45. CGenericApp NEAR theApp;
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CGenericApp initialization
  49.  
  50. BOOL CGenericApp::InitInstance()
  51. {
  52.     // Standard initialization
  53.     // If you are not using these features and wish to reduce the size
  54.     //  of your final executable, you should remove from the following
  55.     //  the specific initialization routines you do not need.
  56.  
  57.     SetDialogBkColor();        // Set dialog background color to gray
  58.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  59.     EnableVBX();               // Initialize VBX support
  60.  
  61.     // Register the application's document templates.  Document templates
  62.     //  serve as the connection between documents, frame windows and views.
  63.  
  64.     CMultiDocTemplate* pDocTemplate;
  65.     pDocTemplate = new CMultiDocTemplate(
  66.         IDR_GENERITYPE,
  67.         RUNTIME_CLASS(CGenericDoc),
  68.         RUNTIME_CLASS(CMDIChildWnd),        // standard MDI child frame
  69.         RUNTIME_CLASS(CGenericView));
  70.     AddDocTemplate(pDocTemplate);
  71.  
  72.     // create main MDI Frame window
  73.     CMainFrame* pMainFrame = new CMainFrame;
  74.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  75.         return FALSE;
  76.     m_pMainWnd = pMainFrame;
  77.  
  78.     // create a new (empty) document
  79.     OnFileNew();
  80.  
  81.     if (m_lpCmdLine[0] != '\0')
  82.     {
  83.         // TODO: add command line processing here
  84.     }
  85.  
  86.     // The main window has been initialized, so show and update it.
  87.     pMainFrame->ShowWindow(m_nCmdShow);
  88.     pMainFrame->UpdateWindow();
  89.  
  90.     return TRUE;
  91. }
  92.  
  93. /////////////////////////////////////////////////////////////////////////////
  94. // CAboutDlg dialog used for App About
  95.  
  96. class CAboutDlg : public ZVBDialog
  97. {
  98. public:
  99.     CAboutDlg();
  100.  
  101. // Dialog Data
  102.     //{{AFX_DATA(CAboutDlg)
  103.     enum { IDD = IDD_ABOUTBOX };
  104.     CEdit    m_edEdit1;
  105.     ZSpin m_spin;
  106.     //}}AFX_DATA
  107.  
  108. // Implementation
  109. protected:
  110.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  111.     //{{AFX_MSG(CAboutDlg)
  112.     virtual BOOL OnInitDialog();
  113.     //}}AFX_MSG
  114.     DECLARE_MESSAGE_MAP()
  115. };
  116.  
  117. CAboutDlg::CAboutDlg() : ZVBDialog(CAboutDlg::IDD)
  118. {
  119.     //{{AFX_DATA_INIT(CAboutDlg)
  120.     //}}AFX_DATA_INIT
  121. }
  122.  
  123. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  124. {
  125.     ZVBDialog::DoDataExchange(pDX);
  126.     //{{AFX_DATA_MAP(CAboutDlg)
  127.     DDX_Control(pDX, IDC_EDIT1, m_edEdit1);
  128.     //}}AFX_DATA_MAP
  129. }
  130.  
  131. BEGIN_MESSAGE_MAP(CAboutDlg, ZVBDialog)
  132.     //{{AFX_MSG_MAP(CAboutDlg)
  133.     //}}AFX_MSG_MAP
  134. END_MESSAGE_MAP()
  135.  
  136. // App command to run the dialog
  137. void CGenericApp::OnAppAbout()
  138. {
  139.     CAboutDlg aboutDlg;
  140.     aboutDlg.DoModal();
  141. }
  142.  
  143. BOOL CAboutDlg::OnInitDialog()
  144. {
  145.     ZVBDialog::OnInitDialog();
  146.     m_spin.SubclassVBControl (this, IDC_SPIN1, TRUE);
  147.     m_spin.SetEditControl (m_edEdit1.m_hWnd);
  148.     return TRUE;  // return TRUE  unless you set the focus to a control
  149. }
  150.